<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="test"></div>
    <script src="../lib/react.development.js"></script>
    <script src="../lib//react-dom.development.js"></script>
    <script src="../lib/babel.min.js"></script>
    <script type="text/babel"> 
    class MyComponent extends React.Component{
        showData=()=>{
            console.log(this)
            console.log(this.refs.input.value)//通过ref和refs获取dom(而且是真实dom)
        }
        show=()=>{
console.log(this.refs.input2.value)
        }
        render(){
          return(
              <div>
                <input type="text" ref='input' placeholder="点击按钮提示数据"/>&nbsp;
                <button onClick={this.showData}>点我提示左侧的数据</button>&nbsp;
                <input type="text" ref='input2' onBlur={this.show} placeholder="失去焦点提示信息"/>
                </div>
          )
        }
    }
    ReactDOM.render(<MyComponent/>,document.getElementById('test'))
    </script>
</body>
</html>